package com.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dao.AuctionDao;
import com.dao.FeedbackDao;
import com.mybatis.po.Auction;
import com.mybatis.po.Feedback;
@Controller
public class FeedbackController {
	@Autowired
	public FeedbackDao feedbackDao;
	@Autowired
	public AuctionDao auctionDao;
	@RequestMapping("/returnFeedback")
	@ResponseBody//提交反馈意见
	public Map<String, String> commitFeedback(Feedback feedback) {
		System.out.print("22222222222"+feedback.toString());
		Map<String,String> map = new HashMap<String, String>();
		//如果反馈意见非空,才可以插入
		if(feedback.getOpinion() != null) {
			if(feedbackDao.CreateFeedback(feedback) == 1) {//插入记录返回1，则说明修改成功
				map.put("state", "commit success");
			}else {//插入失败，返回fail
				map.put("state", "fail");
			}
		}else {//否则则返回发反馈失败
			map.put("state", "fail");
		}
		return map;
	}
	
	
}
